-module(test_log4erl).

-export([init/0, log/0]).

init()->
    init_log4erl(),
    %% io:format("io: ~p~w", log4erl:get_appenders()),
    log4erl:warn("warn2 msg"),
    log4erl:info("info2 msg"),
    log4erl:error("error2 msg").

log()->
    log4erl:warn("warn3 msg"),
    log4erl:info("info3 msg"),
    log4erl:error("error3 msg").

init_log4erl() ->
    application:start(log4erl),
    log4erl:add_file_appender(test_logger, {".", "test", {size, 100000}, 10, log, info}),
    log4erl:add_file_appender(run_logger, {".", "run", {daily, 0}, 10, log, info}),
    log4erl:add_file_appender(app, {".", "app", {size, 100000}, 10, log, info}),
    log4erl:change_format(app, "%j %h:%m:%s [%L] %l%n"),
    log4erl:add_console_appender(cmd_logs, {info, "%j %T [%L] %l%n"}),
    log4erl:warn("warn1 msg"),
    log4erl:info("info1 msg"),
    log4erl:error("error1 msg").
    